<template>
<view class="body">
    <view class="title">
        <view class="first">时间</view>
        <view class="middle">{{type == "hit" ? "个人中签率（%）" : "个人最低成交价（元）"}}</view>
        <view class="last">{{type == "hit" ? "企业中签率（%）" : "企业最低成交价（元）"}}</view>
    </view>
    <view v-for="(item, index) in info" :key="index" class="title">
        <view class="first">{{item.qi}}</view>
        <view class="middle">{{type == "price" ? item.price.per_min : item.rate.per_rate}}</view>
        <view class="last">{{type == "price" ? item.price.com_min : item.rate.com_rate}}</view>
    </view>
</view>
</template>

<script>
import util from "../../../../utils/util";
const app = getApp();

export default {
  data() {
    return {
      type: "price",
      info: []
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      type: options.type
    });
    if (options.type == "hit") uni.setNavigationBarTitle({
      title: '摇号中签结果'
    });
    util.getUrl(app.globalData.url).then(res => {
      util.request('zhuanti.php', {
        action: "yaohaochaxun",
        citycode: options.citycode,
        qi: options.qi
      }).then(res => {
        this.setData({
          info: res.data.data.year
        });
      });
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {}
};
</script>
<style>
.body {
    padding: 30rpx;
}

.title {
    display: flex;
    align-items: center;
}

.title view {
    height: 60rpx;
    line-height: 60rpx;
    text-align: center;
    font-size: 22rpx;
    color: #000000;
    border: 2rpx solid #02A9F0;
}

.first {
    width: 187rpx;
}

.middle {
    width: 248rpx;
}

.last {
    width: 251rpx;
}
</style>